from datetime import datetime
from sqlalchemy import String, Column, DateTime, JSON, Float
from sqlalchemy.orm import declarative_base

Base = declarative_base()

def get_base():
	return Base


class StatisticGraph(Base):
	__tablename__ = 'statistic_graph'
	id = Column(String)
	user = Column(String)
	insert_time = Column(DateTime, primary_key=True)
	json_data = Column(JSON)
	file_name = Column(String)
	region_name = Column(String, primary_key=True)


class StatisticParameter(Base):
	__tablename__ = 'statistic_parameter'
	taskId = Column(String, primary_key=True)
	parameter = Column(JSON)


class StatisticResult(Base):
	__tablename__ = 'statistic_result'
	insert_time = Column(DateTime, primary_key=True)
	result = Column(JSON)

class HL_V_Relationship(Base):
	__tablename__ = "statistic_hl_v_relationship"
	id = Column(String(255), primary_key=True)
	region_name = Column(String(255))
	statistic_type = Column(String(255))
	rock_type = Column(String(255))
	a = Column(Float)
	b = Column(Float)
	created_at = Column(DateTime, default=datetime.now)
	updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)


class StatisticVAreaRelationship(Base):
	__tablename__ = 'statistic_v_area_relationship'
	id = Column(String(255), primary_key=True)
	region_name = Column(String(255), primary_key=True)
	statistic_type = Column(String(255))
	rock_type = Column(String(255), primary_key=True)
	a = Column(Float)
	b = Column(Float)
	created_at = Column(DateTime, default=datetime.now)
	updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)